﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.ComponentModel.DataAnnotations;
using Steve.UI.Administration.DataAnnotations;

namespace Steve.UI.Tests
{
    [TestClass]
    public class DescriptionDataAnnotationsModelMetadataProvider_Tests
    {
        private sealed class MetadataTestClass
        {
            [Display(Description="TestDescription")]
            public string WithDescription { get; set; }

            public string WithoutDescription { get; set; }
        }

        [TestMethod]
        public void Test_CreateMetadata()
        {
            var provider = new AdministrationModelMetadataProvider();

            var model = new MetadataTestClass();

            var meta = provider.GetMetadataForProperty(new Func<object>(() => model), typeof(MetadataTestClass), "WithDescription");

            Assert.AreEqual("TestDescription", meta.Description);
        }
    }
}
